package com.wbq.datastructuredemo.activity;

import java.util.List;

import com.wbq.datastructuredemo.R;
import com.wbq.datastructuredemo.domain.Basic;
import com.wbq.datastructuredemo.tools.HttpUtils;
import com.wbq.datastructuredemo.tools.JsonTools;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class BasicActivity extends Activity {
	private static final String TAG = "BasicActivity";
	private TextView textView;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_basic);
		textView = (TextView) findViewById(R.id.tv_content);
		HttpUtils httpUtils= new HttpUtils(BasicActivity.this);
		int url_path = R.string.basics_list_url; 
		String jsonString = httpUtils.getJsonContent(url_path);
		List<Basic> list = JsonTools.getBasics("basics", jsonString);
		Log.i(TAG, list.toString());
		for(Basic basic : list){
			textView.setText(basic.getContent());
		}
	}
	
}
